package com.fragments.sendmail;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

import android.annotation.SuppressLint;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.fragments.BaseFragment;
import com.senditcertified.mail.R;
import com.senditcertified.mail.widget.dialog.HelpDialog;
import com.senditcertified.mail.widget.dialog.RecordDialog;

@SuppressLint("SimpleDateFormat")
public class AudioFragment extends BaseFragment implements OnClickListener {
	private RecordDialog rd;
	private View tvHaveAudio;
	
	@Override
	protected void initViews() {
		// TODO Auto-generated method stub
		tvHaveAudio = getView().findViewById(R.id.tv_have_audio);
	}

	@Override
	protected void initComponents() {

	}

	@Override
	protected void addListener() {
		getView().findViewById(R.id.btn_record).setOnClickListener(this);
		getView().findViewById(R.id.btn_show_me).setOnClickListener(this);
		getView().findViewById(R.id.btn_help_record).setOnClickListener(this);
	}

	@Override
	protected int initLayout() {
		// TODO Auto-generated method stub
		return R.layout.sendmail_audio_fragment;
	}

	public String getFiles() {
		return rd.getFileName();
	}
	
	@Override
	public void onClick(View v) {
		int id = v.getId();
		if (id == R.id.btn_record) {
			rd = new RecordDialog(getActivity().getParent()){
				@Override
				public void onDismiss() {
					super.onDismiss();
					tvHaveAudio.setVisibility(View.VISIBLE);
				}
			};
			rd.show();
		} else if (id == R.id.btn_show_me) {
		} else if (id == R.id.btn_help_record) {
			new HelpDialog(getActivity().getParent(),
					getString(R.string.send_mail_audio_help_title),
					getString(R.string.send_mail_audio_help_content)).show();
		} else {
		}
	}

}
